﻿
-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Andre Lashley>
-- Create date: <04/04/2011>
-- Description:	<sp_User_GetByID>
-- =============================================
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'sp_User_GetByID')
	BEGIN
		DROP  Procedure  sp_User_GetByID
	END

GO

CREATE PROCEDURE sp_User_GetByID 
	-- Add the parameters for the stored procedure here
	(
				@UserKey int,
				
				@Sys_IsDeleted int = 0,
				@Sys_OrganizationID int = -1
				
	)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;

	SELECT	[UserKey],
			[UserLoginID],
			[UserPassword],
			[UserFirstName],
			[UserLastName],
			[UserPrimaryEmailID],
			[UserVerificationCode],
			[UserIsVarified],
			[Sys_DateOfCreation],
			[Sys_DateOfModification],
			[Sys_CreatedByID],
			[Sys_ModifiedByID],
			[Sys_DeleteType],
			[Sys_IsDeleted],
			[Sys_OrganizationID],
			[Sys_InitialPrimaryKeys],
			[Sys_WorkstationName]
	FROM	[User]
	WHERE		
		(
			[UserKey] = @UserKey AND 
			[Sys_IsDeleted] = @Sys_IsDeleted AND
			[Sys_OrganizationID] = @Sys_OrganizationID
		);
END
GO
